package com.yulongtian.offers.day202209.day20220926;

/**
 * https://leetcode.cn/problems/bu-yong-jia-jian-cheng-chu-zuo-jia-fa-lcof/?favorite=xb9nqhhg
 *
 * @author YulongTian
 * @date 2022/9/26 - 12:30
 */
public class Test02 {
    public static void main(String[] args) {
        System.out.println(add(-4, 6));

    }

    public static int add(int a, int b) {
        while (b != 0) {
            int carry = (a & b) << 1;
            a = a ^ b;
            b = carry;
        }
        return a;
    }


}
